package com.hinnotek.amoeba.repo

import com.hinnotek.amoeba.api.ApiService
import com.hinnotek.amoeba.base.BaseBean
import com.hinnotek.amoeba.bean.old.ProductManagermentDetailBean
import com.lee.common.base.BaseRepository
import com.lee.common.network.net.StateLiveData
import okhttp3.RequestBody
import javax.inject.Inject

class ProductRepo @Inject constructor(val service: ApiService) : BaseRepository() {

    /**
     * app端获取合同列表分页接口
     */
    suspend fun getProductTypeById(
        productTypeId: Int,
        stateLiveData: StateLiveData<ProductManagermentDetailBean>
    ) {
        executeResp({ service.getProductTypeById(productTypeId) }, stateLiveData)
    }

    suspend fun updateProductPrice(
        productTypeId: Int,
        productPrice: String,
        stateLiveData: StateLiveData<BaseBean>
    ) {
        executeResp({ service.updateProductPrice(productTypeId, productPrice) }, stateLiveData)
    }

    suspend fun addProductPicture(
        imgs: Array<RequestBody?>,
        createUser: String,
        deleteIds: String,
        productTypeId: Int,
        stateLiveData: StateLiveData<BaseBean>
    ) {
        executeResp(
            { service.addProductPicture(imgs, createUser, deleteIds, productTypeId) },
            stateLiveData
        )
    }


}